<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2022/1/12
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>汽车出租</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top:5px;">
    <legend>查询条件</legend>
    <div class="demoTable" style="margin: 10px">
        <div class="layui-inline">
            <p>身份证号：</p><input class="layui-input" placeholder="身份证号" name="identity" id="identitySel" autocomplete="off">
        </div>
        <button class="layui-btn"  id="identitySearch" data-type="reload">搜索</button>
    </div>
</fieldset>
<table <%--style="display: none"--%> id="test" lay-filter="test1"></table>

<%--操作工具栏--%>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="allAuditing" >汽车出租</a>
    <a class="layui-btn layui-btn-xs" lay-event="allAuditing">查看原图</a>
</script>

</body>

<script>
    layui.use(['table','jquery','form','layer','laydate','element','upload'], function(){
        var table = layui.table;
        var $ = layui.jquery;
        var form = layui.form;
        var layer = layui.layer;
        var laydate= layui.laydate;
        var element = layui.element;
        var upload = layui.upload;
        //搜索时，执行表格的重载事件
        $("#identitySearch").click(function (){
            table.reload('test1',{
                where: { //设定异步数据接口的额外参数
                    identity:$("#identitySel").val()
                }
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });//只重载数据
        })
        //加载表格的实例
        table.render({
            id:'test1',
            elem: '#test'
            ,url:'${pageContext.request.contextPath}/rent/listByCondition'
            //,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            ,title: '汽车出租表'
            ,cols: [[
                {type: 'checkbox', fixed: 'left'}
                ,{field:'carnumber', title:'车牌号',fixed: 'left'}
                ,{field:'cartype', title:'汽车类型',height:50}
                ,{field:'color', title:'颜色'}
                ,{field:'price', title:'汽车价格'}
                ,{field:'rentprice', title:'租车价格'}
                ,{field:'deposit', title:'押金'}
                ,{field:'description', title:'描述'}
                ,{field:'isrenting', title:'是否出租'/*,templet: function (data) {
                        //console.log(data);
                        return data==null?"":data.shaftchoose.shaftchoose;
                    }*/}
                ,{field:'carimg', title:'缩略图'}
                ,{field:'createtime', title:'创建时间'}
                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:200}
            ]]
            ,page: true
            ,limit:5
            ,limits:[5,10,15]
        });

    })
</script>
</html>